const replacementChars = '0987654321aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ';

let publicKey = '';
let privateKey = '';
let cypherText = '';
let originalText = '';

function createPrivateKey() {
    // Example private key generation (manual for simplicity)
    privateKey = 'CBA';
}

function createPublicKey() {
    // Example public key generation (manual for simplicity)
    publicKey = 'ABC';
}

function encrypt(input) {
    createPublicKey(); // Generate the public key
    createPrivateKey(); // Generate the private key

... // To change by using this Workflow
     // Use Character map defined globally...
     // Use publicKey string position of first character
     // Use publicKey string position of second character
     // Use publicKey string position of third character
    // char(1) ^ char(2) % char(3)
  // First find and calculate exponentiation 
  // Find modulus and round to nearest whole integer
    // Use Character map defined globally...
     // Map each character of input to Character map...
     // Use a left string shift by result of above operations
     // Generate Cyphertext

  
    console.log('Made Key...', privateKey); // From private key function
    console.log('Encrypted...', cypherText); // From this function
    console.log('Made key...', publicKey); // From public key function
}

function decrypt(key) {
    // Check if the provided key exactly matches the privateKey
    if (key !== privateKey) {
        console.log('Invalid key. Decryption failed.');
        return;
    }

    // Check if the reversed key is a substring of the publicKey
    const reversedKey = key.split('').reverse().join('');
    if (!publicKey.includes(reversedKey)) {
        console.log('Key mismatch. Decryption failed.');
        return;
    }
    // To start use globally available Cyphertext

... // To change by using this Workflow
     // Use Character map defined globally...
     // Use key (privateKey) string position of third character
     // Use key (privateKey) string position of second character
     // Use key (privateKey) string position of first character
    // char(3) ^ char(2) % char(1)
     // Use method above, which is the inverse of the Cypher operations 
      // Prefer method above instead of just reversing privateKey
      // To allow us to be exact
  // First find and calculate exponentiation 
  // Find modulus and round to nearest whole integer
    // Use Character map defined globally...
     // Map each character of Cyphertext to Character map...
     // Use a right string shift by result of above operations
     // Generate Decrypted original Text

    console.log('Using key...', key); // To compare key to privateKey
    console.log('Using key...', privateKey); // To compare to key
    console.log('Decrypted...', originalText); // From this function
  
  
}

const stringInput = "Hello, World!";

console.log('Receiving...');
encrypt(stringInput);

console.log('Decrypting...');
decrypt(privateKey);

console.log('Finishing...');
